﻿//===================================================================================
// Copyright (c) Ryan Garrett.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===================================================================================

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Caffeine.Core.Test
{
    [TestClass]
    public class ValidationErrorTester
    {
        [TestMethod]
        public void Test()
        {
            ValidationError errorA = new ValidationError();
            ValidationError errorB = new ValidationError();

            Assert.IsFalse(errorA.Equals(null));
            Assert.IsTrue(errorA.Equals(errorA));
            Assert.IsTrue(errorA.Equals(errorB));

            errorA.ErrorCode = 1;
            errorA.ErrorDescription = "Error Description";

            errorB.ErrorCode = errorA.ErrorCode;
            errorB.ErrorDescription = errorA.ErrorDescription;

            Assert.IsTrue(errorA.Equals(errorB));

            errorA.ErrorCode = 2;

            Assert.IsFalse(errorA.Equals(errorB));

            errorA.ErrorCode = errorB.ErrorCode;
            errorA.ErrorDescription = String.Empty;

            Assert.IsFalse(errorA.Equals(errorB));

            errorA.ErrorDescription = errorB.ErrorDescription;

            Assert.IsTrue(errorA.Equals(errorB));
        }
    }
}
